package beta;

import javax.microedition.lcdui.Graphics;


public abstract class Item 
{
    public final static int ALIGN_LEFT = 1;
    public final static int ALIGN_RIGHT = 2;
    public final static int ALIGN_CENTER = 3;
    protected int alignment = ALIGN_LEFT;
    
    private boolean focusable;
    
    public Item(boolean f)
    {
        focusable = f;
    }

    public boolean isFocusable()
    {
        return focusable;
    }
    
    public void setAlignment(int a)
    {
        alignment = a;
    }
    
    public abstract int getPreferredHeight(int width);
    
    boolean onKeyPressed(int key)
    {
        return false;
    }

    void onKeyReleased(int key)
    {
        
    }
    
    void onKeyRepeated(int key)
    {
        
    }
    
    protected final void repaint()
    {
        ScreenManager.callRepaint();
    }
    
    public abstract void print(Graphics g, boolean selected, int width, int height);
    /*
    {
        Theme theme = ScreenManager.getCurrentTheme();
        if(selected)
            theme.drawSelectionBorder(g, width, height);
        g.setColor(theme.fontColor);
        g.setFont(theme.defaultFont);
        g.drawString("Item nr: " + (licznik++), width / 2, (30 - theme.defaultFont.getHeight()) / 2, Graphics.TOP | Graphics.HCENTER);
    }
     * */
}
